# Maintainer: Antonio Rojas <arojas@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch to fix up makefile for 32-bit builds

pkgname=lrs
pkgver=073
_pkgver=${pkgver/./}
pkgrel=1
pkgdesc='C implementation of the reverse search algorithm for vertex enumeration/convex hull problems'
arch=(x86_64)
url='http://cgm.cs.mcgill.ca/~avis/C/lrs.html'
license=(GPL-2.0-or-later)
depends=(glibc
         gmp)
source=(http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/lrslib-$_pkgver.tar.gz
        lrs-system-cflags.patch
        32-bit-support.patch)
sha256sums=('c49a4ebd856183473d1d5a62785fcdfe1057d5d671d4b96f3a1250eb1afe4e83'
            '617ed06ae2584ef3349a3b1f6ab1a4acd11f18211394458498e1223a65bb0e73'
            '09ec4ed0d3e5894ef9542f18db76d5f9c5dd5d88013ee54765a54279911cf3f3')

prepare() {
  cd lrslib-$_pkgver
  patch -p1 -i ../lrs-system-cflags.patch # Use system CFLAGS/LDFLAGS
  [[ $CARCH != "aarch64" ]] && patch -p0 -i ../32-bit-support.patch || true
}

build() {
  cd lrslib-$_pkgver
  make
}

package() {
  cd lrslib-$_pkgver
  make DESTDIR="$pkgdir" prefix=/usr install
}
